#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QObject::connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(addValue()));
    QObject::connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(findValue()));
}

void MainWindow::addValue() {
  data.insert(ui->lineEdit_2->text(), ui->lineEdit->text());
  ui->listWidget_2->addItem(ui->lineEdit_2->text());
}

void MainWindow::findValue() {
  ui->lineEdit->setText(data.value(ui->lineEdit_2->text(), "nenalezena"));
}

MainWindow::~MainWindow() {
  delete ui;
}
